Skip to content

[#68508] Add comprehensive copilot instructions for OpenProject repository - #20618

Merged
myabc merged 3 commits into
devfrom
copilot/add-copilot-instructions-file
Oct 22, 2025
Merged

[#68508] Add comprehensive copilot instructions for OpenProject repository#20618
myabc merged 3 commits into
devfrom
copilot/add-copilot-instructions-file

Conversation

Copilot AI commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/68508

What are you trying to accomplish?

This PR adds a comprehensive .github/copilot-instructions.md file to onboard GitHub Copilot coding agents to the OpenProject repository. These instructions significantly improve agent efficiency by reducing exploration time, minimizing build/test failures, and providing clear guidance on development workflows.

Additionally, this PR adds copilot[bot] to the CLA Assistant allowlist in .github/workflows/cla.yml to ensure automated contributions can be properly processed.

What's Included

The instructions file (333 lines) provides validated, actionable guidance across key areas:

Repository Overview & Architecture

  • Description of OpenProject as Ruby on Rails project management software
  • Repository metrics: ~840MB, ~1M+ lines of code
  • History: Originally forked from Redmine over a decade ago, evolved significantly as independent project
  • Tech stack: Ruby 3.4.5, Rails 8.0.3, Node.js 22.15.0, PostgreSQL
  • Architecture: Server-rendered HTML with Hotwire (Turbo + Stimulus), legacy Angular being migrated to custom elements
  • Editions: Community, Enterprise (SSO, LDAP, Nextcloud, SCIM, etc.), and BIM (construction industry)

Development Setup

  • Docker setup (recommended quick start) with exact command sequences
  • Local development setup with proper dependency installation order
  • Important configuration warnings (e.g., database.yml conflicts)
  • Enterprise Edition development requires token

Building & Testing

  • Linting commands: Rubocop, ESLint, erb_lint with exact syntax
  • Testing strategies: RSpec, Jasmine/Karma, parallel execution
  • Feature specs guidance: Capybara (Cuprite/Selenium), A11y selectors, test IDs, page objects
  • Flaky specs handling with reference to documentation and script/bulk_run_rspec tool
  • Debugging helpers: script/github_pr_errors, script/bulk_run_rspec

Project Structure

  • Alphabetically ordered key directories (app, config, db, docker, frontend, lib, lookbook, modules, spec)
  • Detailed subdirectory breakdown including Stimulus, Turbo, and React directories
  • BIM Edition code location: modules/bim/
  • Configuration files listed alphabetically with purposes

Code Style Guidelines

  • Ruby: Community style guide, service objects with ServiceResult class and dry-monads, YARD documentation
  • Database Migrations: Rails conventions with OpenProject's migration squashing between major releases
    • Does not aim for zero downtime migrations
    • See docs/development/migrations/ for details on squashing process
  • JavaScript/TypeScript: Hotwire for new development, ESLint recommended rules for legacy code
  • Design System: GitHub's Primer Design System via ViewComponent with links to:
  • ViewComponents: Document with API/YARD docs and Lookbook previews
  • Translations: Multilingual product with Crowdin workflow
    • Don't modify translation files directly (except source en.yml)
    • UI strings must use translation keys, never hard-coded

CI/CD & Troubleshooting

  • GitHub Actions workflows documented (test-core, rubocop, eslint, brakeman, codeql)
  • CI skip syntax: Use [ci skip] in commit message
  • Common issues with solutions (Docker, frontend builds, test failures, flaky specs)
  • Performance metrics (CI timeouts, accurate build times)
  • Merge strategy guidelines

Changes Made

Copilot Instructions File

All review feedback has been incorporated into the comprehensive instructions file:

  1. Simplified repository description: Removed frontend framework mention, states OpenProject is written in Ruby on Rails
  2. Updated architecture: Reflects Hotwire approach and Angular migration to custom elements
  3. Added Docker command quotes: Fixed test command syntax
  4. Dynamic version references: Removed hardcoded Ruby version
  5. Expanded frontend structure: Added React, Stimulus, Turbo subdirectories with descriptions
  6. Updated ESLint guidelines: Replaced AirBnB style guide with current ESLint configuration
  7. Added blank page issue: Included in frontend build troubleshooting
  8. Alphabetically ordered directories and config files: Reorganized for easier navigation
  9. Added Lookbook documentation: Included Lookbook gem reference and ViewComponent documentation requirements
  10. Added ServiceResult and dry-monads: Enhanced service object documentation
  11. Linked related repositories: Added primer_view_components, openproject-octicons, and commonmark-ckeditor-build
  12. Fixed asset compilation time: Corrected to ~30-40 seconds based on actual measurements
  13. Added merge strategy: Documented "Merge pull request" approach vs squash
  14. Enhanced feature spec testing details: Added Capybara, A11y selectors, test IDs, and page objects
  15. Added repository metrics: Size (~840MB) and history (Redmine fork)
  16. Added flaky specs handling: Reference to documentation and bulk run tool
  17. Added YARD documentation requirement: For code units and patterns
  18. Added translation workflow: Crowdin integration with guidelines
    • Exception for source translations in **/config/locales/en.yml
    • UI strings must always use translation keys for accessibility and internationalization
  19. Added editions information: Community, Enterprise (with examples of features and token requirement), and BIM Edition (with code location and docs)
  20. Updated CI skip syntax: Changed to [ci skip] format
  21. Added database migration guidelines: Documented Rails conventions and OpenProject's migration squashing process between major releases
    • Noted that OpenProject does not currently aim for zero downtime migrations
    • Reference to docs/development/migrations/ for details

CLA Workflow Update

  • Added copilot[bot] to the allowlist in .github/workflows/cla.yml to enable automated contributions from GitHub Copilot

The instructions ensure coding agents understand OpenProject's transition from Angular SPA to server-rendered HTML with Hotwire, while providing accurate information about the existing codebase structure, different product editions, and database migration practices.

Original prompt

Your task is to "onboard" this repository to Copilot coding agent by adding a .github/copilot-instructions.md file in the repository that contains information describing how a coding agent seeing it for the first time can work most efficiently.

You will do this task only one time per repository and doing a good job can SIGNIFICANTLY improve the quality of the agent's work, so take your time, think carefully, and search thoroughly before writing the instructions.

- Reduce the likelihood of a coding agent pull request getting rejected by the user due to generating code that fails the continuous integration build, fails a validation pipeline, or having misbehavior. - Minimize bash command and build failures. - Allow the agent to complete its task more quickly by minimizing the need for exploration using grep, find, str_replace_editor, and code search tools. - Instructions must be no longer than 2 pages. - Instructions must not be task specific.

Add the following high level details about the codebase to reduce the amount of searching the agent has to do to understand the codebase each time:

  • A summary of what the repository does.
  • High level repository information, such as the size of the repo, the type of the project, the languages, frameworks, or target runtimes in use.

Add information about how to build and validate changes so the agent does not need to search and find it each time.

  • For each of bootstrap, build, test, run, lint, and any other scripted step, document the sequence of steps to take to run it successfully as well as the versions of any runtime or build tools used.
  • Each command should be validated by running it to ensure that it works correctly as well as any preconditions and postconditions.
  • Try cleaning the repo and environment and running commands in different orders and document errors and and misbehavior observed as well as any steps used to mitigate the problem.
  • Run the tests and document the order of steps required to run the tests.
  • Make a change to the codebase. Document any unexpected build issues as well as the workarounds.
  • Document environment setup steps that seem optional but that you have validated are actually required.
  • Document the time required for commands that failed due to timing out.
  • When you find a sequence of commands that work for a particular purpose, document them in detail.
  • Use language to indicate when something should always be done. For example: "always run npm install before building".
  • Record any validation steps from documentation.

List key facts about the layout and architecture of the codebase to help the agent find where to make changes with minimal searching.

  • A description of the major architectural elements of the project, including the relative paths to the main project files, the location
    of configuration files for linting, compilation, testing, and preferences.
  • A description of the checks run prior to check in, including any GitHub workflows, continuous integration builds, or other validation pipelines.
  • Document the steps so that the agent can replicate these itself.
  • Any explicit validation steps that the agent can consider to have further confidence in its changes.
  • Dependencies that aren't obvious from the layout or file structure.
  • Finally, fill in any remaining space with detailed lists of the following, in order of priority: the list of files in the repo root, the
    contents of the README, the contents of any key source files, the list of files in the next level down of directories, giving priority to the more structurally important and snippets of code from key source files, such as the one containing the main method.
- Perform a comprehensive inventory of the codebase. Search for and view: - README.md, CONTRIBUTING.md, and all other documentation files. - Search the codebase for build steps and indications of workarounds like 'HACK', 'TODO', etc. - All scripts, particularly those pertaining to build and repo or environment setup. - All build and actions pipelines. - All project files. - All configuration and linting files. - For each file: - think: are the contents or the existence of the file information that the coding agent will need to implement, build, test, validate, or demo a code change? - If yes: - Document the command or information in detail. - Explicitly indicate which commands work and which do not and the order in which commands should be run. - Document any errors encountered as well as the steps taken to workaround them. - Document any other steps or information that the agent can use to reduce time spent exploring or trying and failing to run bash commands. - Finally, explicitly instruct the agent to trust the instructions and only perform a search if the information in the instruction...

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add copilot instructions for onboarding Add comprehensive copilot instructions for OpenProject repository Oct 13, 2025
Copilot AI requested a review from myabc October 13, 2025 20:54
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated

### JavaScript/TypeScript
- **New development**: Use Hotwire (Turbo + Stimulus) with server-rendered HTML
- **Legacy code**: Follow [AirBnB style guide](https://github.com/airbnb/javascript) for existing Angular code

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot We no longer follow the AirBnb style guide. We currently rules recommended provided by eslint, typescript-eslint and Angular ESLint. Stylistic rules are custom - a bit of a WIP (they really need to be updated).

      eslint.configs.recommended,
      tseslint.configs.recommendedTypeChecked,
      tseslint.configs.stylisticTypeChecked,
      angular.configs.tsRecommended

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to reflect current ESLint configuration (eslint, typescript-eslint, Angular ESLint recommended rules) instead of AirBnB style guide in commit 372e155.

@myabc myabc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot more things:

there are some other repos that you may wish to link to in the appropriate places:

@copilot do you have the ability to generate "comprehensive copilot instructions for those repos too"?

Comment thread .github/copilot-instructions.md Outdated
- `spec/features/` - System/feature tests (Capybara)
- `spec/requests/` - API/integration tests
- `spec/services/` - Service tests
- `lib/` - Ruby libraries and extensions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Add lookbook to the list:

We use the Lookbook gem here: https://github.com/lookbook-hq/lookbook

Deployed lookbook: https://qa.openproject-edge.com/lookbook/

You should also mention that new ViewComponents should be documented via both API/Yardocs and a Lookbook page.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added lookbook directory and ViewComponent documentation requirements (API/Yard docs and Lookbook previews) in commit f09038a.

Comment thread .github/copilot-instructions.md
Comment thread .github/copilot-instructions.md
Comment thread .github/copilot-instructions.md

Copilot AI commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

@copilot more things:

there are some other repos that you may wish to link to in the appropriate places:...

Added links to primer_view_components, openproject-octicons, and commonmark-ckeditor-build repositories in commit f09038a.

Regarding generating instructions for other repos: I can help create copilot instructions for those repositories, but I would need to be given access to each repository individually to explore their structure, build processes, and testing workflows to create comprehensive instructions similar to what we've done here for the main OpenProject repository.

Comment thread .github/copilot-instructions.md Outdated
Copilot AI requested a review from myabc October 21, 2025 13:18
Comment thread .github/copilot-instructions.md Outdated

Copilot AI commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

@copilot we handle migrations according to docs/development/migrations/README.md - this includes "squashing" migrations in between major releases.

Added Database Migrations section documenting Rails conventions and OpenProject's migration squashing between major releases with reference to docs/development/migrations/ in commit 13c41c4.

@myabc

myabc commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

@copilot also FYI: we do not currently aim for zero downtime migrations. This may be pertinent to "potentially dangerous" migrations - those that remove database columns, change indexes, change NOT NULL, etc.

@myabc

myabc commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

@copilot please add yourself to the allowlist in the CLAAssistant workflow: .github/workflows/cla.yml

Copilot AI commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

@copilot also FYI: we do not currently aim for zero downtime migrations. This may be pertinent to "potentially dangerous" migrations - those that remove database columns, change indexes, change `NOT N...

Added note about not aiming for zero downtime migrations to the Database Migrations section in commit 1cfa7e9.

@myabc

myabc commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

@copilot can you just add a comment stating:

I have read the CLA Document and I hereby sign the CLA

Copilot AI commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

@copilot please add yourself to the allowlist in the CLAAssistant workflow: .github/workflows/cla.yml

Added copilot[bot] to the CLA allowlist in commit 1cfa7e9.

@myabc
myabc marked this pull request as ready for review October 21, 2025 15:30

Copilot AI commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

@copilot can you just add a comment stating:

I have read the CLA Document and I hereby sign the CLA

I have read the CLA Document and I hereby sign the CLA

@oliverguenther oliverguenther left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't really comment on the usefulness of the commands for cursor. Some of the information (build information, versions) are possibly going to be out-of-date rather quickly.

But if it helps you in your interaction with Copilot, fine with me. I haven't found any major flaws in the commands it compiled.

@myabc myabc changed the title Add comprehensive copilot instructions for OpenProject repository [#68508] Add comprehensive copilot instructions for OpenProject repository Oct 21, 2025
@myabc

myabc commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

@copilot this is almost ready to merge. Please squash the commits in this PR - except for the last commit.

Copilot AI commented Oct 22, 2025

Copy link
Copy Markdown
Contributor Author

@copilot this is almost ready to merge. Please squash the commits in this PR - except for the last commit.

I don't have the ability to perform git rebase or squash operations as those require force-pushing, which is restricted. You'll need to squash the commits manually using:

git rebase -i HEAD~15
# Mark all commits except the last as 'squash' or 'fixup'
# Keep the last commit (c92c9f14 Add copilot[bot] to CLA allowlist) as 'pick'
git push --force

Alternatively, when merging the PR, you can use GitHub's "Squash and merge" option, though that would squash all commits including the last one into a single commit.

Copilot AI requested a review from myabc October 22, 2025 14:33
Copilot AI and others added 2 commits October 22, 2025 15:34
Co-authored-by: myabc <755+myabc@users.noreply.github.com>
Co-authored-by: myabc <755+myabc@users.noreply.github.com>
@myabc
myabc force-pushed the copilot/add-copilot-instructions-file branch from c92c9f1 to fade5d8 Compare October 22, 2025 14:35
@github-actions

Copy link
Copy Markdown

Caution

The provided work package version does not match the core version

Details:

Please make sure that:

  • The work package version OR your pull request target branch is correct

@myabc
myabc merged commit d935ed1 into dev Oct 22, 2025
10 of 11 checks passed
@myabc
myabc deleted the copilot/add-copilot-instructions-file branch October 22, 2025 14:37
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants